<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>地址管理</title>
    <link rel="stylesheet" href="../CSS/public-css.css">
    <link rel="stylesheet" href="../CSS/addrManage-css.css">
    <link rel="stylesheet" href="../CSS/font-awesome.min.css">
</head>
<script src="../js/jquery-3.4.1.min.js"></script>

<body>
<div class="main-div">
    <div class="header-div">
        <div class="logo-div">
            <img src="../img/goktech-img/images/logo.png" alt="无法加载图片">
        </div>
        <div class="form-div">
            <form action="">
                <input type="search" placeholder="热门搜索：干花花瓶">
                <input type="button">
            </form>
        </div>
    </div>
    <div class="body-div">
        <div class="nav-div">
            <ul>
                <li><a href="../homePage.jsp">商品首页</a></li>
                <li><a href="#">所有商品</a>
                    <div class="dropdown-content-one">
                        <div class="wrapper">
                            <a href="#">
                                <div class="img-div-one">
                                    <img src="../img/WebProgram/img/nav1.jpg" alt="无法加载图片">
                                </div>
                                <div class="dropdown-text-div">
                                    <span>浓情欧式</span>
                                </div>
                            </a>
                            <a href="#">
                                <div class="img-div-one">
                                    <img src="../img/WebProgram/img/nav2.jpg" alt="无法加载图片">
                                </div>
                                <div class="dropdown-text-div">
                                    <span>浪漫美式</span>
                                </div>
                            </a>
                            <a href="#">
                                <div class="img-div-one">
                                    <img src="../img/WebProgram/img/nav3.jpg" alt="无法加载图片">
                                </div>
                                <div class="dropdown-text-div">
                                    <span>雅致中式</span>
                                </div>
                            </a>
                            <a href="#">
                                <div class="img-div-one">
                                    <img src="../img/WebProgram/img/nav6.jpg" alt="无法加载图片">
                                </div>
                                <div class="dropdown-text-div">
                                    <span>简约现代</span>
                                </div>
                            </a>
                            <a href="#">
                                <div class="img-div-one">
                                    <img src="../img/WebProgram/img/nav5.jpg" alt="无法加载图片">
                                </div>
                                <div class="dropdown-text-div">
                                    <span class="text-span">创意装饰</span>
                                </div>
                            </a>
                        </div>
                    </div>
                </li>
                <li><a href="#">装饰摆件</a></li>
                <li><a href="#">布艺软饰</a></li>
                <li><a href="#">墙饰壁挂</a></li>
                <li><a href="#">蜡艺香薰</a></li>
                <li><a href="#">创意家居</a></li>
            </ul>
        </div>
        <div class="location-div">
            <div class="parcel-div">
                <a href="../homePage.jsp">首页</a>
                <span>&nbsp;&nbsp;/&nbsp;&nbsp;</span>
                <a href="grzx.jsp">个人中心</a>
                <span>&nbsp;&nbsp;/&nbsp;&nbsp;</span>
                <a href="grzx.jsp">我的中心</a>
            </div>
        </div>
        <div class="wrapper-div">
            <div class="userManage-div">
                <span><a href="goods-Manage.jsp">用户管理</a></span>
            </div>
            <div class="parcel-div">
                <div class="sideleft">
                    <div class="parcel-div">
                        <div class="head-portrait-div">
                            <img src="../img/goktech-img/images/tx.png" alt="无法加载图片">
                        </div>
                        <div class="userInfo-div">
                            <span>[初茶]</span>&nbsp;&nbsp;
                            <span><a href="#">[退出登录]</a></span>
                        </div>
                    </div>
                    <div class="nav-div">
                        <div class="mydeal-div">
                            <ul>
                                <li><a href="#">我的交易</a></li>
                                <li><a href="gwc.jsp">我的购物车</a></li>
                                <li><a href="#">我的订单</a></li>
                                <li><a href="#">评价晒单</a></li>
                            </ul>
                        </div>
                        <div class="grzx-div">
                            <ul>
                                <li><a href="#">个人中心</a></li>
                                <li><a href="grzx.jsp">我的中心</a></li>
                                <li><a href="addrManage.jsp">地址管理</a></li>
                            </ul>
                        </div>
                        <div class="accountManage-div">
                            <ul>
                                <li><a href="#">账户管理</a></li>
                                <li><a href="grxx.jsp">个人信息</a></li>
                                <li><a href="updatePwd.jsp">修改密码</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="sideright">
                    <div class="top-div">
                        <span>我的地址</span>
                        <span>添加地址</span>
                    </div>
                    <div class="bottom-div">
                        <div class="address">

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer-div">
        <div class="top-div">
            <div class="parcel-div">
                <div class="clearfix">
                    <img src="../img/temp1/foot1.png" alt="无法加载图片">
                    <span>7天无理由退货</span>
                </div>
                <div class="clearfix">
                    <img src="../img/temp1/foot2.png" alt="无法加载图片">
                    <span>15天免费换货</span>
                </div>
                <div class="clearfix">
                    <img src="../img/temp1/foot3.png" alt="无法加载图片">
                    <span>满599包邮</span>
                </div>
                <div class="clearfix">
                    <img src="../img/temp1/foot4.png" alt="无法加载图片">
                    <span>手机特色服务</span>
                </div>
            </div>
        </div>
        <div class="botton-div">
            <p>最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br>
                违法和不良信息举报电话:400-800-8200,本网站所列数据,除特殊说明,所有数据均出自我司实验室测试
            </p>
        </div>
    </div>
    <!--遮罩-->
    <div class="mask"></div>
    <!-- 添加地址 -->
    <div class="add-address">
        <div class="close-lable">
            <span class="fa fa-times fa-lg"></span>
        </div>
        <div class="title">
            <span>添加地址</span>
        </div>
        <div class="information">
            <input class="consignee-name1" type="text" placeholder="请输入收货人姓名">
            <div class="userName-tip"></div>
            <input class="consignee-addr1" type="text" placeholder="请输入收货人地址">
            <div class="userAddr-tip"></div>
            <input class="consignee-phone1" type="text" placeholder="请输入收货人联系方式">
            <div class="userPhone-tip"></div>
        </div>
        <div class="save-addr-btn">
            <button class="btn1">保存</button>
            <button>取消</button>
        </div>
    </div>
    <!-- 编辑地址 -->
    <div class="edit-address">
        <div class="close-lable">
            <span class="fa fa-times fa-lg"></span>
        </div>
        <div class="title">
            <span>编辑地址</span>
        </div>
        <div class="information">
            <input class="consignee-name2" type="text" placeholder="请输入收货人姓名">
            <div class="userName-tip"></div>
            <input class="consignee-addr2" type="text" placeholder="请输入收货人地址">
            <div class="userAddr-tip"></div>
            <input class="consignee-phone2" type="text" placeholder="请输入收货人联系方式">
            <div class="userPhone-tip"></div>
        </div>
        <div class="save-addr-btn">
            <button>保存</button>
            <button>取消</button>
        </div>
    </div>
</div>
</body>
<script src="../js/addrManage-js.js"></script>
<script>
    $(function () {
        $.ajax({
            url: "${pageContext.request.contextPath}/address?method=AddressAll",
            type: "post",
            dataType: "json",
            success: function (message) {
                var str=``;
                console.log(message);
                for(var i=0 ; i<message.length ; i++){
                    str += `<div class="addr-child">
                                <div class="more-information">
                                    <div class="left-part">
                                        <span>`+message[i].aName+`</span>
                                        <span>[默认地址]</span>
                                    </div>
                                    <div class="center-part">
                                        <span>[设为默认]</span>
                                    </div>
                                    <div class="right-part">
                                        <span>删除</span>
                                        <span>|</span>
                                        <span>编辑</span>
                                    </div>
                                </div>
                                <div class="real-addr">
                                    <span>`+message[i].aAddress+`</span>
                                </div>
                                <div class="phoneNmuber">
                                    <span>`+message[i].aPhone+`</span>
                                </div>
                            </div>`;
                }
                console.log(str);
                $(".address").html(str);
            },
            error: function () {
                console.log("错误")
            }
        })
        $(".btn1").click(function () {
            $.ajax({
                url: "${pageContext.request.contextPath}/address?method=addAddress",
                type: "post",
                data: {"aName": $(".consignee-name1").val(), "aAddress": $(".consignee-addr1").val(), "aPhone": $(".consignee-phone1").val()},
                dataType: "json",
                success: function (message) {
                    location.href = "${pageContext.request.contextPath}/ProgramJSP/addrManage.jsp";
                },
                error: function () {
                    console.log("错误")
                }
            });
        });
    })
</script>
</html>
